<!DOCTYPE html>
<html>
<head>
<title>XSCHEM ELEMENTS</title>
<link rel="stylesheet" type="text/css" href="xschem_man.css" />
<style type="text/css">
/* Local styling goes here */
p{padding: 15px  30px 10px;}

</style>

</head>
<body>

<!-- start of slide -->
<div class="content">   
<!-- navigation buttons -->
<a href="run_xschem.html" class="prev">PREV</a>
<a href="xschem_man.html" class="home">UP</a>
<a href="building_xschem_symbol.html" class="next">NEXT</a>

 <!-- slide title -->
 <h1> XSCHEM ELEMENTS</h1><br>

  <h3> WIRES </H3>
  <p>
   Wires in XSCHEM are the equivalent of copper traces in printed circuit boards or electrical conductors.
   Wires are drawn as lines but the electrical connectivity graph is built by XSCHEM.
   To draw a wire segment point the mouse somewhere in the drawing window and press the <kbd>'w'</kbd> key. 
   A rubber wire is shown with one end following the mouse. Clicking the left mouse button
   finishes the placement. The following picture shows a set of connected wires. There are many 
   wire segments but only 3 electrical nodes. XSCHEM recognizes connection of wires and uses this 
   information to build up the circuit connectivity. All wires are drawn on the 'wire' layer. One 
   electrical node in the picture below has been highlighted in red (this is a XSCHEM function we 
   will cover later on).
  </p>
  <img src="xschem_wires.png">

  <h3> LINES </h3>
  <p>
   Lines are just segments that are used for drawing. Lines do not have any electrical meaning, in fact
   when building the circuit netlist, lines are completely ignored. XSCHEM uses different layers to draw 
   lines. Each layer has its own color, allowing to draw with different colors. Lines are placed like
   wires, but using the <kbd>'l'</kbd> key. The 'Layers' menu allows to select various different layers (colors) 
   for the line.
  </p>
  <img src="xschem_lines.png">
  <h3> RECTANGLES </h3>
  <p>
   Rectangles like Lines are drawable on multiple layers, and also do not carry any electrical information.
   A specific 'PIN' layer is used to make pins that are used to interconnect wires and components.
   Different fill styles (or no fill) can be defined for each layer. Rectangles are placed with the 
   <kbd>'r'</kbd> bindkey
  </p>
  <img src="xschem_rectangles.png">
  <h3> POLYGONS </h3>
  <p>
   Polygons are paths that can be drawn on any layer. Placements begins with the <kbd>'p'</kbd> key
   and continues as long as the user clicks points on the drawing area. Placement ends when:</p>
   <ul>
   <li> the last point is coincident to the first point.</li>
   <li>  or by clicking the <kbd>right mouse button</kbd>,  for an open polygon. </li>
   <li>  or by hitting the <kbd>Return</kbd> key, for a closed polygon
         (this can be done also by clicking the last point coincident to the first polygon point).</li>
   </ul>
  <p>
  A <kbd>fill=true</kbd> attribute may be given to have the shape filled with the layer fill style.
  </p>
  <img src="xschem_polygons.png">
  <h3> CIRCLES / ARCS </h3>
  <p> 
   Arcs may be placed by hitting the <kbd>Shift-C</kbd> key. First click the start point, then the end point. 
   Moving the mouse will show the arc passing thru the 2 points and the mouse waypoint. 
   Clicking will place the arc.
   Arcs may be modified after creation by selecting in stretch mode (<kbd> Ctrl-Button1-drag </kbd>) one of the arc ends
   or the arc center:<br>
   - (end point selected in stretch mode): by starting a move (<kbd>m</kbd>) 
      operation and moving the mouse the arc sweep may be changed.<br>
   - (start point selected in stretch mode):by starting a move (<kbd>m</kbd>) operation and moving the mouse the start arc angle may be changed.<br>
   - (arch center selected in stretch mode): by starting a move (<kbd>m</kbd>) operation and moving the mouse the arc radius may be changed.<br>
   If a circle is needed then use the <kbd>Ctrl-Shift-C</kbd> key combination.
   <br>A <kbd>fill=true</kbd> attribute may be given to have the shape filled with the layer fill style.
  </p>
  <img src="xschem_elements_01.png">

  <h3> TEXT </h3>
  <p>
   Text can be placed with the <kbd>'t'</kbd> bindkey. 
   A dialog box appears where the user inputs the text and text size. 
  </p>
  <img src="xschem_texts.png">
  <p>
   The <kbd>layer</kbd> property can be used
   to draw text on a different layer, for example, setting <kbd>layer=6</kbd> will draw on cyan color. 
   A <kbd>font</kbd> property is defined to change the default font.
   A <kbd>hcenter=true</kbd> attribute may be set to center text in the reading direction, 
   while <kbd>vcenter=true</kbd> centers text in the perpendicular (to reading) direction.
   the 2 attributes may be set both to get full centered text box.<br>
   A <kbd>weight=bold</kbd> attribute may be given for bold text, while a <kbd>slant=italic</kbd> or
   <kbd>slant=oblique</kbd> may specify italic or slanted text.<br>
   A <kbd>hide=true</kbd> will make the specified text invisible unless the <kbd>View-&gt;Show hidden texts</kbd>
   option is enabled.
   If <kbd>hide=instance</kbd> is given the text will be invisible in placed instances of the symbol, but visible 
   when descending into the symbol.
  </p>  
  <img src="xschem_elements_02.png">
  <p>
   You wil learn in the <a href="xschem_properties.html">xschem properties chapter</a>
   how to set, edit and change object properties.
  </p>
  <img src="xschem_texts1.png">
  <h3> SYMBOLS </h3>
  <p>
   Symbols are graphical elements that represent electrical components. A symbol represents an electronic
   device, like for example a resistor, a bipolar transistor, an amplifier etc. As you can see graphically 
   symbols are built with lines, rectangles, polygons and texts, the graphical primitives shown before.
   In the picture below some components are placed in a schematic window. Components are instances of symbols.
   For example you see three placements of the 'npn' bipolar transistor symbol. 
   Like in C++, where objects are instances of classes, here components are instances of symbols.
  </p>
  <img src="xschem_symbols.png">
  <p>
   Symbols (like schematic drawings) are stored in xschem libraries. 
   For XSCHEM a library is just a directory placed under the 
   XSCHEM_LIBRARY_PATH directory, see the <a href="install_xschem.html">installation slide</a>.
   A symbol is stored in a .sym file.
  </p>
   <pre class=code style="height: 240px;">
user:~$ cd .../share/xschem/xschem_library/
user:xschem_library$ ls
devices
user:xschem_library$ cd devices
user:devices$ ls *.sym
ammeter.sym                generic.sym            noconn.sym             switch_hsp.sym
arch_declarations.sym      gnd.sym                npn.sym                switch.sym
architecture.sym           ind.sym                opin.sym               title.sym
assign.sym                 iopin.sym              package_not_shown.sym  tline_hsp.sym
attributes.sym             ipin.sym               package.sym            use.sym
bus_connect_not_shown.sym  isource_arith.sym      param_agauss.sym       vccs.sym
bus_connect.sym            isource_pwl.sym        param.sym              vcr.sym
capa.sym                   isource.sym            parax_cap.sym          vcvs.sym
cccs.sym                   k.sym                  pmos3.sym              vdd.sym
ccvs.sym                   lab_pin.sym            pmos4.sym              verilog_delay.sym
connect.sym                lab_wire.sym           pmosnat.sym            verilog_timescale.sym
delay_hsp.sym              launcher.sym           pnp.sym                vsource_arith.sym
delay_line.sym             netlist_at_end.sym     port_attributes.sym    vsource_pwl.sym
delay.sym                  netlist_not_shown.sym  res.sym                vsource.sym
diode.sym                  netlist.sym            spice_probe.sym        zener.sym
flash_cell.sym             nmos3.sym              spice_probe_vdiff.sym
generic_pin.sym            nmos4.sym              switch_hsp_pwl.sym
user:devices$ cd ...share/doc/xschem/
user:xschem$ ls
examples  pcb
   </pre>
  <p>
   To place a symbol in the schematic window press the <kbd>'Insert'</kbd> key. A file chooser pops up, 
   go to the xschem devices directory (<kbd>.../share/xschem/xschem_library/devices</kbd> in the distribution
   by default) and select a symbol (res.sym for example).
   The selected symbol will be instantiated as a component in the schematic at the mouse
   pointer coordinates.
  </p>
 <!-- end of slide -->
 <div class="filler"></div>
</div>

<!-- frame footer -->
<iframe seamless src="xschem_footer.html"  class="footer_iframe" >
</body>
</html>

